package seu.evaluation.metric;


/**
 * 
 * @author samantha
 * 度量扇入扇出复杂度
 *
 */
public class ComplexityFFC extends MaintainabilityMetricStrategy{
	private Integer ccn;
	
	public ComplexityFFC(){
		ccn=-1;
	}

	@Override
	protected String getType() {
		return "ComplexityFFC";
	}

	@Override
	/**
	 * 计算单个组件的扇入扇出度并将结果返回
	 */
	protected double differentMetricMethod(MaintainabilityEntity entity) {	
		return (int) Math.pow( ( entity.getE()+entity.getW() ) * ( entity.getX()+entity.getR() ) , 2.0) * ccn;
	}

	@Override
	protected void preprocess() {
		ccn=umlDiagramInfo.getTotalE()-umlDiagramInfo.getN()+2*umlDiagramInfo.getL();	
	}

}
